package com.hdu.degrete.degrate;


import lombok.Data;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


@Data
public class BeanAndMethodHolder {
    private Object bean;
    private Method method;


    public BeanAndMethodHolder(Object bean, Method method) {
        this.bean = bean;
        this.method = method;
        method.setAccessible(true);
    }

    public Object invoke() {
        try {
            return method.invoke(bean);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
}
